package receiver;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

import application.UIApplication;

public abstract class DownloadLoadingReceiver extends BroadcastReceiver{

	public static final String Action = UIApplication.PackageName+".Receiver.DownloadLoading";
	@Override
	public void onReceive(Context context, Intent intent) {
		if (Action.equals(intent.getAction())){
			String tag = intent.getStringExtra("tag");
			String url = intent.getStringExtra("url");
			long total = intent.getLongExtra("total", 0);
			long current = intent.getLongExtra("current",0);
			DownloadLoading(context, intent, url, total, current,tag);
		}
	}

	/**
	 * 下载中 返回下载状态
	 * @param context
	 * @param intent
	 * @param url 下载地址
	 * @param total 下载的文件总长度
	 * @param current 当前下载到的长度
	 * @param tag 自定义标识
	 */
	public abstract void DownloadLoading(Context context, Intent intent,String url,long total, long current,String tag);

}
